#ifndef CHATUSERWID_H
#define CHATUSERWID_H

#include <QWidget>
#include <QSize>
#include "listitembase.h"
#include "userdata.h"

/***************************************************************
* @file    chatuserwid.h
* @brief   用户列表中用户item
*
* @author  轻语
* @date    2025/02/22
* @history
***************************************************************/

namespace Ui {
class ChatUserWid;
}

class ChatUserWid : public ListItemBase
{
    Q_OBJECT
public:
    explicit ChatUserWid(QWidget *parent = nullptr);
    ~ChatUserWid();
    QSize sizeHint() const {
        return QSize(250, 70); // 返回自定义的尺寸
    }
    void SetInfo(QString name, QString head, QString msg);
    void SetInfo(std::shared_ptr<UserInfo> user_info);
    std::shared_ptr<UserInfo> GetUserInfo();
    void updateLastMsg(QVector<std::shared_ptr<TextChatData>>msgs);
private:
    Ui::ChatUserWid *ui;
    QString _name;
    QString _head;
    QString _msg;
    std::shared_ptr<UserInfo> _user_info;
};

#endif // CHATUSERWID_H
